﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Liger.Web.Common;
using Liger.Web.Common.Extensions;

namespace Liger.Web.UI
{
    public class MenuBuilder : UIComponentBuilderBase, IHideObjectMembers
    {
        private Menu Menu
        {
            get
            {
                return this.Component as Menu;
            }
        }


        public MenuBuilder()
            : base(new Menu())
        {

        }

        public MenuBuilder(Menu Menu)
            : base(Menu)
        {

        }

        /// <summary>
        /// 设置属性
        /// </summary>
        /// <param name="property"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public MenuBuilder Set(string property, object value)
        {
            if (this.Menu.Properties.ContainsKey(property))
            {
                this.Menu.Properties[property] = value;
            }
            else
            {
                this.Menu.Properties.Add(property, value);
            }
            return this;
        }

        /// <summary>
        /// 返回ligerMenu的Manager
        /// </summary>
        /// <param name="manager">manager的对象名</param>
        /// <returns></returns>
        public MenuBuilder Manager(string manager)
        {
            this.Menu.Manager = manager;
            return this;
        }


        public MenuBuilder Width(int value)
        {
            this.Menu.Width = value;
            return this;
        }
        public MenuBuilder Top(int value)
        {
            this.Menu.Top = value;
            return this;
        }
        public MenuBuilder Left(int value)
        {
            this.Menu.Left = value;
            return this;
        }
        public MenuBuilder Items(string value)
        {
            this.Menu.Items = value;
            return this;
        }
        public MenuBuilder Shadow(bool value)
        {
            this.Menu.Shadow = value;
            return this;
        }
    }
}